import cgi
import datetime
import wsgiref.handlers
import os

from models import *
from services.loanservice import LoanService
from services.bookservice import BookService
from services.userservice import UserService
from services.bookownershipservice import BookOwnershipService

from google.appengine.ext.webapp import template
#from google.appengine.ext import db should never need to access the database directly. go through the services please
from google.appengine.api import users
from google.appengine.ext import webapp

class ClearDataHandler(webapp.RequestHandler):
	def get(self):
		BookOwnershipService().clear()
		UserService().clear()
		LoanService().clear()
		BookService().clear()
		self.redirect('/')

application = webapp.WSGIApplication([
  ('/clear', ClearDataHandler),
], debug=True)

def main():
	wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
	main()